package com.demo.flight.service.impl;

import com.demo.flight.entity.Administrator;
import com.demo.flight.mapper.AdministratorMapper;
import com.demo.flight.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ssy
 * @create 2022-03-24 13:10
 */

@Service
public class LoginServiceImpl implements LoginService {
    
    @Autowired
    private AdministratorMapper administratorMapper;
    
    @Override
    public boolean login(Administrator administrator) {
        if (administrator == null) {
            return false;
        }
        Administrator existAdministrator = administratorMapper.selectOne(administrator.getAccount());
        if (existAdministrator == null || !existAdministrator.equals(administrator)) {
            return false;
        }
        return true;
    }
}
